<?php
// foreach($data as $key => $val)   foreach($data as $val)

$scores = [
    [
        'id' => '2022000999',
        'name' => '张三',
        'score_1' => 90,
        'score_2' => 80
    ],
    [
        'id' => '2022000788',
        'name' => '李四',
        'score_1' => 90,
        'score_2' => 80
    ]
];

//foreach ($scores as $s) {
//    echo $s['id'] . '-' . $s['name'] . "<br>";
//}
// 名字可以随便取，$key代表每一个元素的下标，$val代表每一个元素
//foreach($scores as $key => $val) {
//    echo $key . '-' . $val['id'] . '-' . $val['name'] . "<br>";
//}

//

$student = [
    'id' => '2020345098',
    'name' => '李四',
    'mobile' => '15955556666',
    'age' => 30
];

foreach ($student as $key => $val) {
    echo $key . ':' . $val . "<br>";
}